﻿@model MVC_No08.Models.Defect

@{
    ViewBag.Title = "Create";
}

<h2>Create</h2>


@using (Html.BeginForm("Create","MyHome",FormMethod.Post))
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal">
        <h4>Defect</h4>
        <hr />
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })


        <div class="form-group">
            @Html.LabelFor(model => model.DeviceID, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownListFor(model => model.DeviceID, ViewBag.deviceList as SelectList, htmlAttributes: new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.DeviceID, "", new { @class = "text-danger" })
            </div>
        </div>


        <div class="form-group">
            @Html.LabelFor(model => model.DefectType, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @{
                    var Type = ViewBag.defectTypeList as SelectList;
                    foreach (var item in Type)
                    {
                        @Html.RadioButtonFor(model => model.DefectType, item.Value, htmlAttributes: new { @checked = "checked" });
                        <span>@item.Text</span>
                    }
                }
                @Html.ValidationMessageFor(model => model.DefectType, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Content, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Content, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.Content, "", new { @class = "text-danger" })
            </div>
        </div>


        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <input type="submit" value="Create" class="btn btn-default" />
            </div>
        </div>
    </div>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
